package org.boot.easyapi.server.expand.impl;

import org.boot.easyapi.expand.AuthenticationUserInfoAbstractInterface;
import org.boot.easyapi.pojo.auto.AuthenticationUserInfo;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;

@Component
public class AuthenticationUserInfoAbstractInterfaceImpl
        implements AuthenticationUserInfoAbstractInterface {

    /**
     * 自定义编写获取当前登录用户信息
     * @return
     */
    @Override
    public AuthenticationUserInfo getAuthenticationUserInfo() {
        //执行获取当前登录用户的逻辑
        // ...
        //返回示例
        return new AuthenticationUserInfo("888","admin@1015","1024");
    }

    /**
     *
     * @param request 请求
     * @param userInfo 用户信息
     * @param menuPerJson 源数据来源表easyapi_core_permission中，当前请求的所需菜单权限信息
     * @param rolePerJson 源数据来源表easyapi_core_permission中，当前请求的所需角色权限信息
     * @return
     */
    @Override
    public boolean hasPermission(HttpServletRequest request,
                                 AuthenticationUserInfo userInfo,
                                 String menuPerJson, String rolePerJson) {
        //执行权限校验逻辑
        //...
        return true;
    }
}
